// Prosty przykad ilustrujcy dziedziczenie

#import <Foundation/Foundation.h>

// Deklaracja i definicja klasy ClassA

@interface ClassA: NSObject
{
    int  x;
}

-(void) initVar;
@end

@implementation ClassA
-(void) initVar
{
    x = 100;
}
@end

// Deklaracja i definicja klasy ClassB

@interface ClassB : ClassA
-(void) printVar;
@end

@implementation ClassB
-(void) printVar
{
    NSLog (@"x = %i", x);
}
@end

int main (int argc, char *argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    ClassB  *b = [[ClassB alloc] init];

    [b initVar];     // Uyje odziedziczonej metody
    [b printVar];    // Pokazuje warto zmiennej x;

    [b release];

    [pool drain];
    return 0;
}